<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model common\models\User */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="user-form">

    <?php $form = ActiveForm::begin(); ?>
    <?php
    if ($model->isNewRecord) {
    ?>
    <?= $form->field($model, 'username')->textInput() ?>
    <?= $form->field($model, 'password_hash')->textInput() ?>
    <?php
    }else{
    ?>
    <?= $form->field($model, 'username')->textInput(['disabled' => true]) ?>
    <?= $form->field($model, 'password_hash')->textInput(['value' => '']) ?>
    <?php
    }
    ?>

    <?= $form->field($model, 'email')->textInput() ?>

    <?= $form->field($model, 'role')->dropDownList(\common\helpers\TStringHelper::getUserRole()) ?>

    <?= $form->field($model, 'status')->dropDownList(\common\helpers\TStringHelper::getStatusText()) ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? Yii::t('common', 'create') : Yii::t('common', 'update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
